package com.interviews.threadlocal;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * SimpleDateFormat 的进化之路
 *
 * @author qian
 * @version 1.0
 * @date 2022/3/3 16:00
 */
public class ThreadLocalDemo01 {

    public static void main(String[] args) throws InterruptedException {
        new Thread(() -> {
            String date = new ThreadLocalDemo01().date(1);
            System.out.println(date);
        }).start();
        Thread.sleep(100);
        new Thread(() -> {
            String date = new ThreadLocalDemo01().date(2);
            System.out.println(date);
        }).start();
    }


    public String date(int second) {
        Date date = new Date(1000 * second);
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("mm:ss");
        return simpleDateFormat.format(date);
    }
}
